package controlador;

import java.io.IOException;
import java.sql.SQLException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletRequest;

import org.apache.commons.fileupload.FileUploadException;


public abstract class FrontCommand {

	protected ServletContext context;
	protected HttpServletRequest request;
	protected HttpServletResponse response;

  public void init (ServletContext context,
	         HttpServletRequest request,
	         HttpServletResponse response)
	{
	  this.context = context;
	  this.request = request;
	  this.response = response;
	}
	
    abstract public void process() throws ServletException, IOException, SQLException, FileUploadException, Exception;
	
    protected void forward(String target) throws ServletException, IOException
	{
	  RequestDispatcher dispatcher = context.getRequestDispatcher(target);
	  dispatcher.forward(request, response);
	}



	}

